/****************************************************************************
**
** BuyGump.h
**
** Copyright (C) August 2014 Hotride
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
*****************************************************************************
*/
//---------------------------------------------------------------------------
#ifndef BuyGumpH
#define BuyGumpH
//---------------------------------------------------------------------------
class TBuyGump
{
private:
	DWORD LastChangedLineTime;
	DWORD LastChangeCountTime;
	DWORD StartChangeCountTime;
	int SelectedLine1;
	int SelectedLine2;
	int SelectedListCount;
	int ContinueCounter;

	int Layers[2];
	
	bool ChangeItemCount(TGump *gump, bool Increase, int idx, int count = 1);
	void CalculateBuyListCount(TGump *gump);
	void CalculateSelectedListCount(TGump *gump);
	void ListingList(TGump *gump, bool Direction, bool GumpNumber, int Divizor = 1);

public:
	TBuyGump() {}
	~TBuyGump() {}

	void Init();

	int Draw(bool &mode, TGump *gump);

	void GenerateFrame(TGump *gump, float PosX, float PosY);
	
	void OnButtonDown(TGump *gump);
	void OnButtonUp(TGump *gump);
	bool OnLeftDoubleClick(TGump *gump);
	void OnMouseWheel(TGump *gump, MOUSE_WHEEL_STATE &state);
};
//---------------------------------------------------------------------------
#endif